<?php
include('FileCache.php');

$total = 100000;
$list = createRandData($total);

// 1. write data
$start_time = microtime(true);
$cache_write_obj = new FileCache('user');
foreach($list as $i => $v)
{
    $cache_write_obj->set($i, $v);
}
$end_time = microtime(true);
echo "write {$total} data used " . (($end_time - $start_time)*1000) . " ms\r\n";


// 2. read data
$start_time = microtime(true);
$read_cache_obj = new FileCache('user');
for ($i=0; $i < $total; $i++) {
    $data = $read_cache_obj->get($i);
}
$end_time = microtime(true);
echo "read {$total} data used " . (($end_time - $start_time)*1000) . " ms\r\n";

